package ui.magic.magiclibs.container.Linear;

import android.content.Context;
import android.graphics.Point;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.WindowManager;
import android.widget.LinearLayout;

import ui.magic.magiclibs.container.Base.MagicInterface;

/**
 * Created by liushiyin on 2017/10/22.
 */

/*
*LinearMagicUi的空组件用于填充空白区域
 */
public class LinearMagicNull extends LinearLayout implements MagicInterface{

    protected Point magicSize;

    public LinearMagicNull(Context context) {
        super(context);
        magicSize=new Point();
    }

    public LinearMagicNull(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        magicSize=new Point();
    }

    public LinearMagicNull(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        magicSize=new Point();
    }

    public Point getWindowSize(){
        WindowManager wm=(WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE);
        Point point=new Point();
        wm.getDefaultDisplay().getSize(point);
        return  point;
    }

    public void setMagicSize(int width,int height){
        magicSize.x=width;
        magicSize.y=height;
    }

    public Point getRealSize(){
        return magicSize;
    }
}
